/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.system;

import com.enation.app.javashop.client.system.RegionsClient;
import com.enation.app.javashop.core.client.fallback.system.RegionsClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.member.vo.RegionVO;
import com.enation.app.javashop.model.system.dos.Regions;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @version v7.0
 * @Description: 地区Client
 * @Author: zjp
 * @Date: 2018/7/27 11:14
 */
@FeignClient(value = "system-service",fallbackFactory = RegionsClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface RegionsClientFeignImpl extends RegionsClient {
    /**
     * 根据地区id获取其子地区
     *
     * @param regionId 地区id
     * @return 地区集合
     */
    @Override
    @RequestMapping(value = "/client/regions/children",method = RequestMethod.GET)
    List<Regions> getRegionsChildren(@RequestParam("region_id")Long regionId);

    /**
     * 获取某个地区
     * @param id 地区主键
     * @return
     */
    @Override
    @RequestMapping(value = "/client/regions/{id}",method = RequestMethod.GET)
    Regions getModel(@PathVariable("id") Long id);

    /**
     * 根据深度获取组织地区数据结构的数据
     *
     * @param depth 地区深度
     * @return 地区集合
     */
    @Override
    @RequestMapping(value = "/client/regions/depth/{depth}",method = RequestMethod.GET)
    List<RegionVO> getRegionByDepth(@PathVariable("depth")Integer depth);
}
